/*
Copyright(c) 2008 Jari Kemppinen <jari@viddem.com>

This example was built upon the PureMVC Framework by Cliff Hall.
http://www.puremvc.org
This example uses the Java PureMVC Framework Version 0.2

Please contribute to the PureMVC community.

License
-------
Your reuse is governed by the Creative Commons Attribution 3.0 license.
 */

package org.lbroussal.client.view;

import org.lbroussal.client.ApplicationFacade;
import org.lbroussal.client.view.components.SplashScreen;
import org.puremvc4gwt.client.interfaces.INotification;
import org.puremvc4gwt.client.patterns.mediator.Mediator;

public class SplashScreenMediator extends Mediator {

    public static final String NAME = "SplashScreenMediator";

    public SplashScreenMediator() {
        super(NAME, null, ApplicationFacade.STARTUP);
    }

    public void GOTOMAIN() {
        // todo cross component logic
        this.notifyObservers(ApplicationFacade.LOGIN);
    }

    private SplashScreen getSplashScreen() {
        return new SplashScreen(this);
    }

    public void handleNotification(INotification note) {
        if (note.getName().equals(ApplicationFacade.STARTUP)) {
            onStartup();
        }
    }

    private void onStartup() {
        ApplicationFacade.loginDemo.setCurrentDisplay(getSplashScreen());
    }
}